<?php
/**
 * Created by PhpStorm .
 * User: 杜磊磊
 * Date: 2020/6/27
 * Time: 15:35
 */
namespace app\api\validate;

use think\validate;


class User extends Validate
{
    protected $rule = [
        'username' => 'require',
        'phone_number' => 'require',
        'code' => 'require|number|min:4',
        'type' => ['require','in'=>'1,2'],
        'sex' => ['require','in' => '1,2,0'],
    ];

    protected $message = [
        'username' => '用户名必须',
        'phone_number' => '手机号必须',
        'code.require' => '验证码必须',
        'code.number' => '验证码必须是数字',
        'code.min' => '验证码最少4位',
        'type.require' => '类型必须',
        'type.in' => '类型数值错误',
        'sex.require' => '性别必须',
        'sex.in'=> '性别类型数组错误',
    ];

    protected $scene = [
        'send_code' => ['phone_number'],
        'login' => ['phone_number','code','type'],
        'update_user' =>['username','sex'],
    ];
}